<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="./Public/Home/org/shop.css"/>
		<script src="./Public/jquery-1.8.2.min.js"></script>
		<script>
			$(function(){	
				$("#toggle-checkboxes_down").click(function(){
//					购物车goods的建
//					var total={{$_SESSION['cart']['total']}}
//					var seid=$(this).attr('key');
//					var num=$(this).parent().parent().siblings().next().children().attr('value');				
					if($('input:checkbox:checked').val()){		

                    $.ajax({
						type:"post",
						url:"{{U('Cart/select_code')}}",
						data:{session:''},
						dataType:'json',
						success:function(db){
							console.log(db);
							$('.money').text(db.totals);	
							
							$('#shopnum').text(db.shopnums);					
						}
					});
                }else{
                	$('.money').text('0');
                	$('#shopnum').text('0');
                }
                
				})			
				$(".sel").change(function(){
					var cid=$(this).children().first().attr('cid');
					var num=$(this).val();
//					alert(num);
					var sid=$(this).attr('key');				
					$.ajax({
					type:'post',
					url:"{{U('Cart/edit')}}",
					data:{num:num,sid:sid},
					dataType:'json',
					success:function(db){
						$('.aa'+cid).text(db.total);
						$('.money').text(db.totals);
					}				
					})						
				});				
			})
		</script>	
	
	</head>	
	<body>
		{{include file="../Common/header"}}
		<!--大盒子-->
		<div id="box">
			<!--搜索开始-->
			<div id="search">
					<a href=""> <img class="tupian" src="./Public/Home/imgs/header-logo-mall-363de.png"/></a>
					<div id="search_in">
<!--						<input type="text" name="" id="" value="" placeholder="请输入关键字" /><a href="" class="sousuo">搜索</a>-->
						<form action='{{U("home/List/ss")}}' method='post'>
							<input type="text" name="ss" id="" value="" placeholder="请输入关键字" />
							<input type='submit' class="sousuo" value='搜索'>
						</form>
					</div>										
			</div>
			<!--搜索结束-->
			<!--分类导航-->
			<div id="category">
				<ul>
					<a href=""><li class="first">我的购物车</li></a>
					<a href="{{U('Index/index')}}"><li class="second">首页</li></a>
					{{foreach from="$cateData" value="$v"}}
					<a href="{{U('List/index',array('cid'=>$v['cid']))}}"><li class="three">{{$v['cname']}}</li></a>
					{{endforeach}}
					<!--<a href=""><li class="three">级别</li></a>-->
					<!--<a href=""><li class="four">分期购车</li></a>
					<a href=""><li class="three">定制车</li></a>-->
				</ul>			
			</div>
			<div class="gwc">
				<ul>
					<li class="allsp">全部商品({{count($data)}})</li>
					<li>订单价格</li>
					<li>数量</li>
					<li>小计</li>
					<li>操作</li>
				</ul>				
			</div>	
			<?php if($data!=null):?>
			<div class="jianjie">
				{{foreach from="$data" key="$k" value="$v"}}
					<ul>
						<a href="{{U('Content/index',array('sid'=>$v['id']))}}">
							<li  class="jianjie-li">						
								<img width="168" height="126" src="{{$v['options']['listgroup']}}"/>
								<span class="wenzi">{{$v['name']}}</span>
								{{foreach from="$v['options']['attribute']" value="$value"}}
								<span class="wenzi">{{$value}}</span>
								{{endforeach}}
								<!--<input key="{{$k}}" num="{{$v['num']}}"  class="selects" style="float: left;margin-top: 5px;"  type="checkbox"  id="" name="toggle-checkboxes" ><label for="toggle-checkboxes_down"></label>-->													
							</li>
						</a>
						<li>{{$v['price']}}万</li>
						<li><select name="" key="{{$k}}" class="sel">stock
								<?php for($i=1;$i<$v['options']['stock']+1;$i++){?>
								<option cid="{{$v['id']}}" value="{{$i}}" <?php if($v['num']==$i):?>selected="selected"<?php endif?>>{{$i}}</option>
								<?php } ?>
						</select></li>
						<li ><span class="aa{{$v['id']}}">{{$v['total']}}</span>万</li>
						<li class="delete">
							<a href="{{U('del',array('del'=>$k))}}">删除</a>&nbsp;
							<a href="{{U('Content/index',array('sid'=>$v['id']))}}">商品详情</a>							
						</li>
					</ul>
					{{endforeach}}
			</div>
				<?php else:?>
				<div style="width: 1170px; height: 50px; line-height: 50px;font-size: 20px; background: #CCCCCC; text-align: center; color: crimson;">
					你的爱车在等着你，去商城看看吧！
				</div>
			<?php endif ?>
			<div class="jiesuan">
				<ul>
					<li><input type="checkbox" checked="checked" id="toggle-checkboxes_down" name="toggle-checkboxes" ><label for="toggle-checkboxes_down">全选</label></li>
					<a href="{{U('Cart/dels')}}"><li>清空购物车</li></a>
					<!--<a href=""><li>移到我的关注</li></a>
					<a href=""><li>清除下柜商品</li></a>-->
					<li class="lingjian">已选择<span id="shopnum">{{$shopnums}}</span>件商品&nbsp;总价：￥<span class="money">{{$_SESSION['cart']['total']}}</span>万</li>
					<a href="{{U('Tijiao/index')}}"><li class="beijing">去结算</li></a>
				</ul>				
			</div>		
		</div>			
		<!--公共底部-->
		{{include file="../Common/footer"}}
	</body>
</html>
